home *** CD-ROM | disk | FTP | other *** search
/ F1 Licenseware / F1 Licenseware - Volume 1.iso / disks / 050a.dms / 050a.adf / TEXTS / chapter22.txt < prev    next >
Text File  |  1992-02-26  |  2KB  |  49 lines

  1.                      The Absolute Beginners Guide To Amos
  2.                     -------------------------------------
  3.                               Chapter Twenty Two
  4.                              -------------------
  5. I hope you suceeded in solving the project I set you in chapter 21. 
  6. In case you didn't or would like to check out my solution here it is:
  7.  
  8. REM Example22.Amos (A possible solution)
  9.  
  10. Hide On 
  11. Unpack 10 To 3
  12.  
  13. Repeat 
  14. If Jleft(1) Then Shift Up 1,1,31,1
  15. If Jright(1) Then Shift Down 1,1,31,1
  16. If Fire(1) Then Shift Off 
  17. Until Mouse Key
  18.  
  19. Default 
  20. Edit 
  21.  
  22. First I loaded the starfield routine in Example21.Amos. and edited the code
  23. to appear as above.
  24.  
  25. After unpacking the screen from bank 10 we hit a brand new command, REPEAT.
  26. This is only half of a command really as it's called a REPEAT UNTIL loop.
  27. It's just like a DO LOOP structure, remember that?  What REPEAT UNTIL does
  28. is it REPEATedly executes the instructions between the REPEAT and the UNTIL 
  29. commands. The UNTIL needs a condition attached to it. In this case I have 
  30. decided that the code will be REPEATed UNTIL a MOUSE KEY has been pressed. 
  31. I could have  put UNTIL INKEY$<>"" (any key press) or UNTIL JUP(1) 
  32. (joystick pushed up) etc.
  33.  
  34. So basically Amos will be looping between the REPEAT UNTIL commands until 
  35. either a MOUSE KEY is pressed or the JRIGHT, JLEFT or FIRE commands are true.
  36. If the joystick is pushed to the left we set the SHIFT UP command in action 
  37. which starts the stars moving. The opposite applies for JRIGHT. 
  38. I have also added the FIRE button to the loop which stops the stars in their
  39. tracks. Not bad for a few lines! 
  40. The source code to Project 1 can be found in the PROJECTS drawer on this 
  41. disk. 
  42.  
  43. I think we have spent long enough on the SHIFT command, fun though it is. 
  44. Please feel free to experiment further, there are lots of tricks that can be 
  45. done. So get out Dpaint and see what you can do.
  46.  
  47.                               End of Chapter 22
  48.                               ^^^^^^^^^^^^^^^^^
  49.